<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:25:"themes/blog/register.html";i:1568365182;s:56:"D:\phpstudy\WWW\TnCMS\public\themes\blog\common\nav.html";i:1568365182;s:59:"D:\phpstudy\WWW\TnCMS\public\themes\blog\common\footer.html";i:1568365182;}*/ ?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>注册</title>
    <link rel="stylesheet" href="/themes/blog/static/layui/css/layui.css" />
    <link rel="stylesheet" href="/themes/blog/static/css/home.css" />
    <script type="text/javascript" src="/themes/blog/static/js/jquery-3.2.1.min.js" ></script>
    <script type="text/javascript" src="/themes/blog//static/layui/layui.js" ></script>
    <script type="text/javascript" src="/themes/blog/static/js/home.js" ></script>
  </head>
  <body>
    <style>
  /*LOGO*/
.logo{font-size:20px;color: #FFFFFF;}
.logo:hover{color: #FFFFFF;}
</style>
<nav style="background-color: #393D49">
    <ul class="layui-nav" lay-filter="" style = "width:1200px;margin:0 auto;">
        <a class="logo" href="#"><?php echo $siteInfo['title']; ?></a>
        <li class="layui-nav-item layui-this"><a href="/">首页</a></li>
        <?php if(is_array($nav[0]) || $nav[0] instanceof \think\Collection || $nav[0] instanceof \think\Paginator): $i = 0; $__LIST__ = $nav[0];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
        <li class="layui-nav-item ">
          <a href="<?php echo $vo['url']; ?>"><?php echo $vo['nav_title']; ?></a>
          <?php if(!(empty($nav[$vo['nav_id']]) || (($nav[$vo['nav_id']] instanceof \think\Collection || $nav[$vo['nav_id']] instanceof \think\Paginator ) && $nav[$vo['nav_id']]->isEmpty()))): ?>
          <dl class="layui-nav-child">
             <?php if(is_array($nav[$vo['nav_id']]) || $nav[$vo['nav_id']] instanceof \think\Collection || $nav[$vo['nav_id']] instanceof \think\Paginator): $i = 0; $__LIST__ = $nav[$vo['nav_id']];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
            <dd><a href=""><?php echo $v['nav_title']; ?></a></dd>
            <?php endforeach; endif; else: echo "" ;endif; ?>
          </dl>
           <?php endif; ?>
        </li>
        <?php endforeach; endif; else: echo "" ;endif; if(empty($userInfo) || (($userInfo instanceof \think\Collection || $userInfo instanceof \think\Paginator ) && $userInfo->isEmpty())): ?>
       <button id="btn-login" style="margin-left: 45%;background: #EB7350;" class="layui-btn">登录</button>
       <a href="/home/index/register" class="layui-btn">注册</a>
       <?php endif; if(!(empty($userInfo) || (($userInfo instanceof \think\Collection || $userInfo instanceof \think\Paginator ) && $userInfo->isEmpty()))): ?>  
        <li class='layui-nav-item' style='float: right;margin-right: 100px;'>
        </li>
        <li class='layui-nav-item' style='float: right;position: relative;left: -100px;'>
            <a href='javascript:;'><img src='<?php if(!(empty($userInfo['face']) || (($userInfo['face'] instanceof \think\Collection || $userInfo['face'] instanceof \think\Paginator ) && $userInfo['face']->isEmpty()))): ?><?php echo $userInfo["face"]; endif; if(empty($userInfo['face']) || (($userInfo['face'] instanceof \think\Collection || $userInfo['face'] instanceof \think\Paginator ) && $userInfo['face']->isEmpty())): ?>/static/images/default_face.jpg<?php endif; ?>' class='layui-nav-img'><?php echo $userInfo["username"]; ?></a>
            <dl class='layui-nav-child'>
                <dd><a href='/home/ucenter/index'>个人中心</a></dd>
                <dd><a href='/home/ucenter/exitLogin'>退出登录</a></dd>
            </dl>
        </li>
       <?php endif; ?>
    </ul>
    <script>
        layui.use('element', function(){
            var element = layui.element;

            //…
        });
    </script>
</nav>
<!--登录注册-->
<div id="LoginDiv" style="display: none;padding-top:20px">
    <form  method="post" id="LoginForm" >
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
               <input type="text" name="username" placeholder="手机号/邮箱/用户名" required lay-verify="required"  autocomplete="off" class="layui-input">
            </div>           
        </div>      
        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-inline">
               <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>          
       </div>
       <div class="layui-form-item" id="code-div" style="display: none;">
            <label class="layui-form-label">验证码</label>
            <div class="layui-input-inline">
               <input style="width:80px;float:left;" type="text" name="code" required lay-verify="required" placeholder="验证码" autocomplete="off" class="layui-input">
               <img style="height:37px;width:110px;cursor: pointer;" id="code-img" style="margin-left:55px;margin-bottom:20px" src="<?php echo captcha_src(); ?>" id="yzm" onclick="this.src='<?php echo captcha_src(); ?>?x='+Math.random();" />
            </div>
       </div>          
       <input style="margin-left:55px;margin-bottom:20px;width:250px;" name="loginsubmit" id="btn_Login" class="layui-btn layui-btn-normal" type="button" value="登录" />
       <p style="margin-left:55px;color:#9F9FA6">第三方登录</p>
       <ul style="margin-left:55px;padding:10px">
         <li style="float:left;margin-right:10px;"><a href="#"><i class="layui-icon layui-icon-login-wechat" style="font-size: 30px; color: #5FB878;"></i></a></li>
         <li style="float:left;"><a href="#"><i class="layui-icon layui-icon-login-qq" style="font-size: 30px; color: #1E9FFF;"></i></a></li>
      </ul>
      <p style="margin-top:40px;text-align:center ;"><a href="<?php echo url('/home/index/register'); ?>">注册</a>|<a href="<?php echo url('/home/index/register'); ?>">忘记密码</a></p>
    </form>
</div>
<script>
    $('#btn-login').click(function(){
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                type: 1,
                title:'用户登录',
                area: ['370px', '410px'],
                content: $('#LoginDiv')
            });
        });
    })

    //登录JS
    $("#btn_Login").click(function(){
        var data = $("#LoginForm").serialize();
        $.ajax({
           type:"post",
            url:'/home/index/login',
            data:data,
            dataType:'json',
            success:function(e){
                switch(e.code)
                {                  
                    case 0:
                        if(e.count > 5){
                        $("#code-div").show();
                        }
                        layer.msg(e.msg, {icon: 5,time:1000});
                        document.getElementById('code-img').src='<?php echo captcha_src(); ?>?x='+Math.random()
                        break;
                    case 1:
                        layer.msg(e.msg, {icon:1});
                        location.href='/';
                        break;


                }

            },
        })
    })
</script>
<!--自定义JS代码-->
<?php echo htmlspecialchars_decode($statistics); ?>
    <div class="layui-tab  layui-tab-brief" style="width:1200px;height:auto;margin:0 auto;background: #FFFFFF;margin-top:30px;margin-bottom:200px">
      <ul class="layui-tab-title">
        <li class="layui-this">邮箱注册</li>
        <li>忘记密码</li> 
      </ul>
      <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
          <blockquote class="layui-elem-quote" style="background: #FFFFFF;">
            <form id="email-data" class="layui-form">
              <div class="layui-form-item">
                <label class="layui-form-label">邮箱</label>
                <div class="layui-input-inline">
                  <input type="text" id="email" name="email" required  lay-verify="required" placeholder="请输入邮箱" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux"><button id="code-email" class="layui-btn layui-btn-normal layui-btn-sm">发送验证码</button></div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">验证码</label>
                <div class="layui-input-inline">
                  <input type="text" name="code" required  lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">请在邮箱内查收验证码</div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">密码</label>
                <div class="layui-input-inline">
                  <input type="password" name="pwd" id="pwd" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">（6-20个字符）</div>
              </div>
              <!--<div class="layui-form-item">
                <label class="layui-form-label">重复密码</label>
                <div class="layui-input-inline">
                  <input type="password" name="repwd"  id="repwd" required lay-verify="required" placeholder="请重复输入密码" autocomplete="off" class="layui-input">
                </div>
              </div>-->
              <div class="layui-form-item">
                <div class="layui-input-block">
                  <button class="layui-btn" lay-submit lay-filter="emailData">立即注册</button>
                  <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
              </div>
            </form>
          </blockquote>
        </div>
        <div class="layui-tab-item">
          <blockquote class="layui-elem-quote" style="background: #FFFFFF;">
            <form class="layui-form" action="">
              <div class="layui-form-item">
                <label class="layui-form-label">邮箱</label>
                <div class="layui-input-inline">
                  <input type="text" id="pwdRetrieveEmail" name="email" placeholder="请输入邮箱" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux"><button type="button" onclick="pwdSendEmail()" class="layui-btn layui-btn-normal layui-btn-sm">发送验证码</button></div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">验证码</label>
                <div class="layui-input-inline">
                  <input type="text" name="code" placeholder="请输入验证码"  class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">请注意查收验证码</div>
              </div>                 
              <div class="layui-form-item">
                <div class="layui-input-block">
                  <button class="layui-btn" lay-submit lay-filter="pwdRetrieve">找回密码</button>
                  <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
              </div>
            </form>         
          </blockquote>
        </div> 
      </div>
    </div>
    <script>
      layui.use("layer");
      //发送找回密码邮箱验证码
      function pwdSendEmail(){
        var email = $("#pwdRetrieveEmail").val();
        $.ajax({
          type:"post",
          data:"email="+email,
          url:"/home/index/pwdSendEmail",
          success:function(e){
            layer.msg(e.msg);
          }
        });
      }
      //找回密码
      layui.use('form', function(){
        var form = layui.form;
        form.on('submit(pwdRetrieve)', function(data){
          $.ajax({
            type:"post",
            data:data.field,
            url:"/home/index/pwdRetrieve",
            success:function(e){
              if(e.code == 1){
                layer.confirm(e.msg, {
                  btn: ['记住了','关闭'] //按钮
                });
              }else{
                layer.msg(e.msg);
              }
            }
          });
          return false;
        });
      });
      //倒计时器
      function Timer(obj) {
        $("#code-time").attr("disabled", "true")
        var time = 60;
        var timestap = "";
        var interval = setInterval(function() {
          if(timestap == "") {
            timestap = time - 1;
          } else {
            timestap = timestap - 1;
          }
          if(timestap == 0) {
            $(obj).removeAttr('disabled');
            $(obj).text("发送验证码");
            clear();
          } else {
            $(obj).text("获取验证(" + timestap + ")")
          }

        }, 1000);

        function clear() {
          clearInterval(interval)
        };
      }

      //发送验证码
      $("#code-email").click(function(){
        var Email = $("#email").val();
        $.ajax({
          type:"post",
          url:"/home/index/regSendEmail",
          data:"email="+ Email,
          success:function(e){
            switch(e.code)
                {
              case 1:
                Timer("#code-email" );
                $("#code-email").attr("disabled","disabled");
                layer.msg(e.msg);
                break;
              case 0:
                layer.msg(e.msg);
                break;                      
            }

          }                     
        });
        return false;
      });

      layui.use('form', function(){
        var form = layui.form;
        var password1 = $("#pwd").val();
        var password2 = $("#repwd").val();
        form.on('submit(emailData)', function(data){
          $.ajax({
            type:"post",
            url:"/home/index/register",
            data:data.field,
            success:function(e){
              switch(e.code)
                  {                   
                case 0:
                  layer.msg(e.msg);
                  break;                    
                case 1:
                  layer.msg(e.msg);
                  setTimeout(function(){  location.href = "/"; }, 2000);
                  break;
              }
            }
          });
          //layer.msg(data.field);
          return false;
        });
      });
    </script>
    <style>
    .link{width:1180px;height:auto;margin: 0 auto;background:#FFF;margin-top:20px;padding:10px;overflow:hidden}
    .link ul li{float:left;margin-right:10px;}
    .link ul li a{color:#8E8E8E;}
    .footer{width: 100%;height: auto;background: #2E2D3C;float:right;margin-top: 20px;padding: 20px 0px 20px 0px }
    .footer .footer_content{width: 1200px;height: auto;margin: 0 auto}
    .footer .footer_content p{color: #FFF}
</style>
<div style="width:100%;height:auto;float: right;">
    <div class="link">
        <h1 style="font-size: 20px;color:#E3670C">友情链接</h1>
        <hr />
        <ul>
            <?php if(is_array($link) || $link instanceof \think\Collection || $link instanceof \think\Paginator): $i = 0; $__LIST__ = $link;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
            <li><a href="<?php echo $vo['link_url']; ?>"><?php echo $vo['link_title']; ?></a></li>
            <?php endforeach; endif; else: echo "" ;endif; ?>
        </ul>
    </div>
</div>
<div class="footer">
    <div class="footer_content">
        <p>反馈建议：mmteen@sina.com</p>
        <p>Copyright © 2018 <?php echo $siteInfo['title']; ?>.保留所有权利<a style="color:#fff;margin-left:30px;" href="http://www.miitbeian.gov.cn"><?php echo $siteInfo['record_number']; ?></a></p>
    </div>
</div>
  </body>
</html>
